package com.xxzb.pack0720;

import java.lang.ref.PhantomReference;
import java.sql.*;

public class Test2 {
    public static void main(String[] args) throws Exception{
        Class.forName("com.mysql.jdbc.Driver");
        String url="jdbc:mysql:///gaofeng2207?useSSL=false";
        String username="root";
        String password="1234";
        Connection conn= DriverManager.getConnection(url,username,password);
        String sql="select listnumber from gaofeng2207.sellrecord\n" +
                "order BY\n" +
                "(left(listnumber,instr(listnumber,'-')-1))*1,\n" +
                "(right(listnumber,(char_length(listnumber)-instr(listnumber,'-'))))*1";
        PreparedStatement ps=conn.prepareStatement(sql);
        ResultSet rs = ps.executeQuery();
        while (rs.next()){
           String listNumber=rs.getString(1);
            System.out.println(listNumber);
        }


    }
}
